﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class System_DbPageFlip1 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    private HZ.MBSM.DBUtility.DbPage m_DbPage;

    public HZ.MBSM.DBUtility.DbPage DbPage
    {
        get { return m_DbPage; }
        set
        {
            m_DbPage = value;

            if (this.DbPage != null && this.DbPage.RowCount > 0)
            {
                string strValue = "<div align=right>";
                if (SysFun.ToDec(this.DbPage.DGJE) != 0)
                {
                    strValue += "定购总金额：<span style='color: #cc0000'>" + this.DbPage.DGJE.ToString() + "</span>元";
                }
                if (SysFun.ToDec(this.DbPage.DHJE) != 0)
                {
                    strValue += "   到货总金额：<span style='color: #cc0000'>" + this.DbPage.DHJE.ToString() + "</span>元";
                }
                if (SysFun.ToDec(this.DbPage.HKJE) != 0)
                {
                    strValue += "   回款总金额：<span style='color: #cc0000'>" + this.DbPage.HKJE.ToString() + "</span>元";
                }
                strValue += "</div>";
                if (this.DbPage.PageIndex > 1)
                {
                    strValue += "<a href=\"javascript:DbPageFlip(" + SysFun.ToTrim(this.DbPage.PageIndex - 1) + ")\">上一页</a> ";
                }
                else
                {
                    strValue += "<font color='#C0C0C0'>上一页</font> ";
                }

                if (this.DbPage.PageIndex < this.DbPage.PageCount)
                {
                    strValue += "<a href=\"javascript:DbPageFlip(" + SysFun.ToTrim(this.DbPage.PageIndex + 1) + ")\">下一页</a> ";
                }
                else
                {
                    strValue += "<font color='#C0C0C0'>下一页</font> ";
                }

                strValue += "［当前第 " + this.DbPage.PageIndex.ToString() + " 页　共 " + this.DbPage.PageCount.ToString() + " 页　计 " + this.DbPage.RowCount + " 条］ ";

                strValue += "转到第";
                strValue += "<select onchange=\"javascript:DbPageFlip(this.selectedIndex+1)\">";
                for (int intIndex = 1; intIndex <= this.DbPage.PageCount; intIndex++)
                {
                    if (intIndex == this.DbPage.PageIndex)
                    {
                        strValue += "<option selected>" + intIndex.ToString();
                    }
                    else
                    {
                        strValue += "<option>" + intIndex.ToString();
                    }
                }
                strValue += "</select>";
                strValue += "页";
                strValue += "<input type='hidden' id='CurrentlyPageIndex1' name='CurrentlyPageIndex1' value='" + this.DbPage.PageIndex.ToString() + "'>";

                this.labDbPage.Text = strValue;
                this.labDbPage.Enabled = true;
            }
            else
            {
                string strValue = "";

                strValue += "<font color='#C0C0C0'>上一页</font> ";
                strValue += "<font color='#C0C0C0'>下一页</font> ";

                strValue += "［当前第 " + this.DbPage.PageIndex.ToString() + " 页　共 " + this.DbPage.PageCount.ToString() + " 页　计 " + this.DbPage.RowCount + " 条］ ";

                strValue += "转到第";
                strValue += "<select onchange=\"javascript:DbPageFlip(this.selectedIndex+1)\">";
                for (int intIndex = 1; intIndex <= this.DbPage.PageCount; intIndex++)
                {
                    if (intIndex == this.DbPage.PageIndex)
                    {
                        strValue += "<option selected>" + intIndex.ToString();
                    }
                    else
                    {
                        strValue += "<option>" + intIndex.ToString();
                    }
                }
                strValue += "</select>";
                strValue += "页";
                strValue += "<input type='hidden' name='CurrentlyPageIndex1' value='" + this.DbPage.PageIndex.ToString() + "'>";
                this.labDbPage.Text = strValue;
                this.labDbPage.Enabled = true;
            }
        }
    }
}
